<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <a-student :sname="aname" :sclass="aclass" :sage="aage" @changeage="change">

      <div slot="sex">性别：男</div>
      <div slot="clothes">衣服颜色：蓝色</div>

    </a-student>

    <h3>下面是父组件</h3>
    <span class="attr">姓名</span> <span>{{aname}}</span> <br>
    <span class="attr">班级</span> <span>{{aclass}}</span> <br>
    <span class="attr">年龄</span> <span>{{aage}}</span> <br>
  </div>
</template>

<script>
import Student from './components/Student'

export default {
  name: 'App',
  components: {
    'a-student': Student
  },
  data: function () {
    return {
      aname: "张三",
      aclass: "2班",
      aage: 20,
    }
  },
  methods: {
    change: function (age) {
      this.aage = age
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.attr {
  color: red;
}
</style>
